package com.guchenbo.example.image;

import com.guchenbo.example.httpclient.HttpUtils;


/**
 * @Author gucb
 * @Date 2017/5/15.
 */
public class ImageTest {

    static byte[] getImage(String url) {
        return HttpUtils.getEntity(url);
    }

    public static void main(String[] args) {
        String url = "https://authcode.jd.com/verify/image?a=1&acid=4756758098597306574&uid=4756758098597306574&yys=1494228914836";
        String str = ImageUtils.encode(getImage(url));

        System.out.println("加密之后的图片验证码："+str);

        String filePath = System.getProperty("user.home") + "/tmp/" + System.currentTimeMillis() + ".jpg";
        System.out.println("解密图片，保存至：" + filePath);
        ImageUtils.decode(str, filePath);
    }
}
